<?php
namespace app\admin\controller;

use \app\common\adapter\AuthAdapter;

class Base2 extends \app\common\controller\ApiPublic {
	
	/**
     * an API used for check whether current user have permission to access
     * 
     * @return <type>
     */
	public function checkUserRule() {
		if (!($require=$this->param('rules')))
			return json_pack([]);
		
		if (is_string($require))
			$require=[$require];
		$ret=[];
		$userInfo=$GLOBALS['userInfo'];
		foreach ($require as $k => $v) {
			if (is_string($v))
				$ret[$k] = AuthAdapter::checkRule($v,$userInfo);
			else
				$ret[$k] = false;
		}
		return json_pack($ret);
	}
}


?>